package io.gitee.zhangbinhub.admin.gateway.bus.publish

import io.gitee.zhangbinhub.admin.common.event.CloudBusEventContent
import io.gitee.zhangbinhub.admin.common.event.RouteLogBusEvent
import io.gitee.zhangbinhub.admin.gateway.log.RouteLogMessage
import org.noear.snack4.ONode
import org.noear.solon.annotation.Component
import org.noear.solon.cloud.CloudClient

/**
 * @since JDK 11
 */
@Component
class RouteLogEventPublish {
    fun doRouteLog(routeLogMessage: RouteLogMessage) {
        RouteLogBusEvent(CloudBusEventContent(message = ONode.serialize(routeLogMessage))).apply {
            CloudClient.event().publish(this.toEvent())
        }
    }
}
